home *** CD-ROM | disk | FTP | other *** search
/ AmigActive 22 / AACD 22.iso / AACD / Programming / RxMUI / Examples / virtual.rexx < prev    next >
Encoding:
OS/2 REXX Batch file  |  2001-05-24  |  6.8 KB  |  244 lines

  1. /* virtual.rexx 1.0 (20.7.2000) */
  2.  
  3. signal on halt
  4. signal on break_c
  5.  
  6. call init
  7. call CreateApp
  8. call HandleApp
  9. /* never reached */
  10. /***********************************************************************/
  11. init: procedure
  12.     l="rmh.library";if ~show("L",l) then;if ~AddLib(l,0,-30) then exit
  13.     if AddLibrary("rxmui.library")~=0 then exit
  14.     return
  15. /***********************************************************************/
  16. MakePage1: procedure
  17.  
  18.     text1=ParseText("
  19. %iHello User !%n\n
  20. \n
  21. This could be a very long text and you are looking\n
  22. at it through a %uvirtual group%n. Please use the\n
  23. scrollbars at the right and bottom of the group to\n
  24. move the visible area either vertically or\n
  25. horizontally. While holding down the small arrow\n
  26. button between both scrollbars, the display will\n
  27. follow your mouse moves.\n
  28. \n
  29. If you click somewhere into a %uvirtual group%n and\n
  30. move the mouse across one of its borders, the group will\n
  31. start scrolling. If you are lucky and own a middle mouse\n
  32. button, you may also want to press it and try moving.\n
  33. \n
  34. When the surrounding window is big enough for the\n
  35. complete virtual group to fit, the scrollers and\n
  36. the move button get disabled.\n
  37. \n
  38. Since this %uvirtual group%n does only contain a\n
  39. single text object, it's a rather simple example.\n
  40. In fact, virtual groups are a lot more powerful,\n
  41. they can contain any objects you like.\n
  42. \n
  43. Note to 7MHz/68000 users: Sorry if you find this\n
  44. thingy a bit slow. Clipping in virtual groups can\n
  45. get quite complicated. Please don't blame me,\n
  46. blame your 'out of date' machine! :-)\n
  47. \n
  48. %i%cHave fun, Stefan.%n%l\n
  49. \n
  50. %uNote From %ialfie%n:\n
  51. in %bRxMUI%n version < 2.4, a virtual group with a\n
  52. frame shows its frame twice.\n")
  53.  
  54.     v.frame="virtual"
  55.     v.UseWinBorder=1
  56.      v.0="t0"
  57.       t0.class="text"
  58.       t0.background="textback"
  59.       t0.contents=text1
  60.  
  61.     res=NewObj("scrollgroup","page1","v")
  62.     if res~=0 then call err(res)
  63.  
  64.     return "page1"
  65. /***********************************************************************/
  66. MakePage2: procedure
  67.  
  68.     text2=ParseText("
  69. %cAs you can see, this virtual group contains a\n
  70. lot of different objects. The (virtual) width\n
  71. and height of the virtual group are automatically\n
  72. calculated from the default width and height of\n
  73. the virtual groups contents.")
  74.  
  75.     v.frame="virtual"
  76.  
  77.      v.0="t1"
  78.       t1.class="text"
  79.       t1.frame="text"
  80.       t1.background="textback"
  81.       t1.contents=text2
  82.  
  83.      v.1="g0"
  84.       g0.class="group"
  85.       g0.horiz=1
  86.        g0.0="g1"
  87.         g1.class="group"
  88.         g1.columns=2
  89.         g1.frame="group"
  90.         g1.FrameTitle="Images"
  91.         do i=0 to 9
  92.          g1.i="im"i;
  93.           interpret "IM"i".CLASS=image"
  94.           interpret 'IM'i'.SPEC='i+11
  95.         end
  96.        g0.1="g2"
  97.         g2.class="group"
  98.         g2.frame="group"
  99.         g2.FrameTitle="Backgrounds"
  100.          g2.0="g3"
  101.           g3.class="group"
  102.           g3.horiz=1
  103.            g3.0="rec0"
  104.             rec0.class="rectangle"
  105.             rec0.frame="text"
  106.             rec0.background="background"
  107.             rec0.FixWidth=30
  108.            g3.1="rec1"
  109.             rec1.class="rectangle"
  110.             rec1.frame="text"
  111.             rec1.background="fill"
  112.             rec1.FixWidth=30
  113.            g3.2="rec2"
  114.             rec2.class="rectangle"
  115.             rec2.frame="text"
  116.             rec2.background="shadow"
  117.             rec2.FixWidth=30
  118.          g2.1="g4"
  119.           g4.class="group"
  120.           g4.horiz=1
  121.            g4.0="rec3"
  122.             rec3.class="rectangle"
  123.             rec3.frame="text"
  124.             rec3.background="shadowback"
  125.             rec3.FixWidth=30
  126.            g4.1="rec4"
  127.             rec4.class="rectangle"
  128.             rec4.frame="text"
  129.             rec4.background="shadowfill"
  130.             rec4.FixWidth=30
  131.            g4.2="rec5"
  132.             rec5.class="rectangle"
  133.             rec5.frame="text"
  134.             rec5.background="shadowshine"
  135.             rec5.FixWidth=30
  136.          g2.2="g5"
  137.           g5.class="group"
  138.           g5.horiz=1
  139.            g5.0="rec6"
  140.             rec6.class="rectangle"
  141.             rec6.frame="text"
  142.             rec6.background="fillback"
  143.             rec6.FixWidth=30
  144.            g5.1="rec7"
  145.             rec7.class="rectangle"
  146.             rec7.frame="text"
  147.             rec7.background="shineback"
  148.             rec7.FixWidth=30
  149.            g5.2="rec8"
  150.             rec8.class="rectangle"
  151.             rec8.frame="text"
  152.             rec8.background="fillshine"
  153.             rec8.FixWidth=30
  154.  
  155.      v.2="g6"
  156.       g6.class="group"
  157.       g6.frame="group"
  158.       g6.columns=2
  159.        g6.0=label("Gauge")
  160.        g6.1="gauge"
  161.         gauge.class="gauge"
  162.         gauge.frame="gauge"
  163.         gauge.horiz=1
  164.         gauge.current=66
  165.        g6.2=VSpace(0)
  166.        g6.3=MakeObj(,"scale")
  167.  
  168.      v.3="sch"
  169.       sch.class="scrollgroup"
  170.       sch.Frame="group"
  171.       sch.FrameTitle="Virtual in virtual"
  172.       sch.virtgroupcontents="vgh"
  173.        vgh.class="virtgroup"
  174.        vgh.frame="virtual"
  175.         vgh.0=button("zero","zero")
  176.         vgh.1=button("one","one")
  177.         vgh.2=button("two","two")
  178.         vgh.3=button("three","three")
  179.         vgh.4=button("four","four")
  180.         vgh.5=button("five","five")
  181.  
  182.     res=NewObj("scrollgroup","page2","v")
  183.     if res~=0 then call err(res)
  184.  
  185.     return "page2"
  186. /***********************************************************************/
  187. HandleApp: procedure  expose global.
  188.     ctrl_c=2**12
  189.     do forever
  190.         call NewHandle("APP","H",ctrl_c)
  191.         if and(h.signals,ctrl_c)>0 then exit
  192.         select
  193.             when h.event="QUIT" then exit
  194.             otherwise nop
  195.         end
  196.     end
  197. /***********************************************************************/
  198. CreateApp: procedure expose global.
  199.  
  200.     app.title="VirtualDemo"
  201.     app.version="$VER: VirtualDemo 1.0 (20.7.2000)"
  202.     app.copyright="©2000, alfie"
  203.     app.author="alfie"
  204.     app.description="Show virtual groups."
  205.     app.base="VIRTUALDEMO"
  206.     app.SubWindow="mwin"
  207.  
  208.      mwin.title="Virtual Groups"
  209.      mwin.ID="VIRT"
  210.      mwin.UseRightBorderScroller=1
  211.      mwin.UseBottomBorderScroller=1
  212.      mwin.contents="mgroup"
  213.  
  214.       mgroup.class="register"
  215.       mgroup.Titles="Page1|Page2"
  216.        mgroup.0=MakePage1()
  217.        mgroup.1=MakePage2()
  218.  
  219.     res=NewObj("application","app")
  220.     if res~=0 then call err(res)
  221.  
  222.     call notify("mwin","CloseRequest",1,"app","ReturnID","quit")
  223.  
  224.     call set("mwin","open",1)
  225.     call getattr("mwin","open","o")
  226.     if o=0 then do
  227.         say "can't open window"
  228.         exit
  229.     end
  230.  
  231.     return
  232. /***********************************************************************/
  233. halt:
  234. break_c:
  235.     exit
  236. /**************************************************************************/
  237. err: procedure expose sigl RxMUIError
  238. parse arg res
  239.     msg = ProgramName()":" GetRxMUIString(res) "in line" sigl-1
  240.     if RxMUIError~="RXMUIERROR" then msg = msg "["RxMUIError"]"
  241.     say msg
  242.     exit
  243. /**************************************************************************/
  244.